<?php
/*

Copyright 2009 Matthew C. Dettinger

This program is free software: you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
if ($_REQUEST[user_request]) {
	session_start();
	// load common lib and dao
	require 'libs/common_functions.php';
	require 'dao/data_group.php';
	require 'dao/file.php';
	require 'dao/session.php';
	require 'dao/user.php';

	// load config file	and check for local copy
	if (file_exists("local_config.php")) {
		require 'local_config.php';
	} else if(file_exists("config.php")) {
		require 'config.php';
	}
	
	dao_session_check_session($config, $_SESSION);
	
	$uuid = dao_user_add_new_user($config, $_REQUEST[new_user]);
	
	c_redirect();
	die();
}

echo '<div id="add_new_user">';
echo '<form name="add_new_user" action="add_new_user.php">';
echo '<input type="text" name="new_user">';
echo '<input type="hidden" name="user_request" value="1">';
echo '<input type="submit" value="Add User">';
echo '</form>';
echo '</div>';

?>